package org.forum.service.impl;

import java.util.List;
import java.util.Set;

import javax.jws.soap.SOAPBinding.Use;

import org.forum.dao.ForumDao;
import org.forum.dao.MainTopicDao;
import org.forum.dao.UserDao;
import org.forum.domain.Forum;
import org.forum.domain.MainTopic;
import org.forum.domain.User;
import org.forum.service.ForumHomepageService;
import org.forum.utils.JsonUtil;
import org.json.JSONObject;

public class ForumHomepageServiceImpl implements ForumHomepageService{
	//spring注入
	private JsonUtil jsonUtil;

	private ForumDao forumDao;

	private UserDao<User> userDao;
	
	private MainTopicDao mainTopicDao;

	@Override
	public List<Forum> getHigh_ProfileForum(int pageNo, int pageSize) {
		return forumDao.getHighProfileForum(pageNo, pageSize);
	}

	@Override
	public void sortByTime(List<MainTopic> mainTopics) {
		//快速排序
	}

	@Override
	public User getAdministrationInfoByForumId(int forumId) {
		//查找管理id
		int administrationId = forumDao.getAdministrationIdByForumId(forumId);
		//根据管理员id查找管理员信息
		User user = userDao.findUserById(administrationId);
		return user;
	}

	@Override
	public MainTopic getAnnouncementInfoByForumId(int forumId) {
		return mainTopicDao.getAnnouncementInfoByForumId(forumId);
	}

	@Override
	public List<MainTopic> getMainTopicsByForumId(int forumId, int pageNo_3, int pageSize) {
		return mainTopicDao.getMainTopicsByForumId(forumId, pageNo_3, pageSize);
	}

	public void setJsonUtil(JsonUtil jsonUtil) {
		this.jsonUtil = jsonUtil;
	}

	public void setForumDao(ForumDao forumDao) {
		this.forumDao = forumDao;
	}

	public void setUserDao(UserDao<User> userDao) {
		this.userDao = userDao;
	}

	public void setMainTopicDao(MainTopicDao mainTopicDao) {
		this.mainTopicDao = mainTopicDao;
	}
}
